const express = require('express');
const router = express.Router();
const { io } = require('../utils/socket');


const outer = require('../handler/record');

// 获取徐工云之钻
router.get('/timing-data', async(req, res) => {
  const data = await outer.getRemoteData();
  io.emit('send', data);
  res.send(data);
});

// 上传导向数据
router.post('/orientation-data', async(req, res) => {
  const data = await outer.recordOrientationData(req.body);
  res.send(data);
});

// 根据项目获取导向数据
router.get('/track', async(req, res) => {
  const data = await outer.getTrackData(req.query);
  res.send(data);
});

module.exports = router;